/**
 */
package uk.ac.york.cs.mv525.modelgen.config.config.provider;

import java.util.ArrayList;
import java.util.Collection;

import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;

import org.eclipse.emf.edit.provider.ChangeNotifier;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.IChangeNotifier;
import org.eclipse.emf.edit.provider.IDisposable;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.INotifyChangedListener;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;

import uk.ac.york.cs.mv525.modelgen.config.config.util.ConfigAdapterFactory;

/**
 * This is the factory that is used to provide the interfaces needed to support Viewers.
 * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
 * The adapters also support Eclipse property sheets.
 * Note that most of the adapters are shared among multiple instances.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public class ConfigItemProviderAdapterFactory extends ConfigAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
	/**
	 * This keeps track of the root adapter factory that delegates to this adapter factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ComposedAdapterFactory parentAdapterFactory;

	/**
	 * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected IChangeNotifier changeNotifier = new ChangeNotifier();

	/**
	 * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected Collection<Object> supportedTypes = new ArrayList<Object>();

	/**
	 * This constructs an instance.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConfigItemProviderAdapterFactory() {
		supportedTypes.add(IEditingDomainItemProvider.class);
		supportedTypes.add(IStructuredItemContentProvider.class);
		supportedTypes.add(ITreeItemContentProvider.class);
		supportedTypes.add(IItemLabelProvider.class);
		supportedTypes.add(IItemPropertySource.class);
	}

	/**
	 * This keeps track of the one adapter used for all {@link uk.ac.york.cs.mv525.modelgen.config.config.ModelElementOverride} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ModelElementOverrideItemProvider modelElementOverrideItemProvider;

	/**
	 * This creates an adapter for a {@link uk.ac.york.cs.mv525.modelgen.config.config.ModelElementOverride}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createModelElementOverrideAdapter() {
		if (modelElementOverrideItemProvider == null) {
			modelElementOverrideItemProvider = new ModelElementOverrideItemProvider(this);
		}

		return modelElementOverrideItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link uk.ac.york.cs.mv525.modelgen.config.config.ModelConfiguration} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ModelConfigurationItemProvider modelConfigurationItemProvider;

	/**
	 * This creates an adapter for a {@link uk.ac.york.cs.mv525.modelgen.config.config.ModelConfiguration}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createModelConfigurationAdapter() {
		if (modelConfigurationItemProvider == null) {
			modelConfigurationItemProvider = new ModelConfigurationItemProvider(this);
		}

		return modelConfigurationItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link uk.ac.york.cs.mv525.modelgen.config.config.ModelElementExclusion} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ModelElementExclusionItemProvider modelElementExclusionItemProvider;

	/**
	 * This creates an adapter for a {@link uk.ac.york.cs.mv525.modelgen.config.config.ModelElementExclusion}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createModelElementExclusionAdapter() {
		if (modelElementExclusionItemProvider == null) {
			modelElementExclusionItemProvider = new ModelElementExclusionItemProvider(this);
		}

		return modelElementExclusionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link uk.ac.york.cs.mv525.modelgen.config.config.FileStringPool} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FileStringPoolItemProvider fileStringPoolItemProvider;

	/**
	 * This creates an adapter for a {@link uk.ac.york.cs.mv525.modelgen.config.config.FileStringPool}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createFileStringPoolAdapter() {
		if (fileStringPoolItemProvider == null) {
			fileStringPoolItemProvider = new FileStringPoolItemProvider(this);
		}

		return fileStringPoolItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link uk.ac.york.cs.mv525.modelgen.config.config.EmbeddedStringPool} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EmbeddedStringPoolItemProvider embeddedStringPoolItemProvider;

	/**
	 * This creates an adapter for a {@link uk.ac.york.cs.mv525.modelgen.config.config.EmbeddedStringPool}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createEmbeddedStringPoolAdapter() {
		if (embeddedStringPoolItemProvider == null) {
			embeddedStringPoolItemProvider = new EmbeddedStringPoolItemProvider(this);
		}

		return embeddedStringPoolItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link uk.ac.york.cs.mv525.modelgen.config.config.StringPoolEntry} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected StringPoolEntryItemProvider stringPoolEntryItemProvider;

	/**
	 * This creates an adapter for a {@link uk.ac.york.cs.mv525.modelgen.config.config.StringPoolEntry}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createStringPoolEntryAdapter() {
		if (stringPoolEntryItemProvider == null) {
			stringPoolEntryItemProvider = new StringPoolEntryItemProvider(this);
		}

		return stringPoolEntryItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link uk.ac.york.cs.mv525.modelgen.config.config.ReferenceOverride} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ReferenceOverrideItemProvider referenceOverrideItemProvider;

	/**
	 * This creates an adapter for a {@link uk.ac.york.cs.mv525.modelgen.config.config.ReferenceOverride}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createReferenceOverrideAdapter() {
		if (referenceOverrideItemProvider == null) {
			referenceOverrideItemProvider = new ReferenceOverrideItemProvider(this);
		}

		return referenceOverrideItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link uk.ac.york.cs.mv525.modelgen.config.config.RandomProducer} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RandomProducerItemProvider randomProducerItemProvider;

	/**
	 * This creates an adapter for a {@link uk.ac.york.cs.mv525.modelgen.config.config.RandomProducer}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createRandomProducerAdapter() {
		if (randomProducerItemProvider == null) {
			randomProducerItemProvider = new RandomProducerItemProvider(this);
		}

		return randomProducerItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link uk.ac.york.cs.mv525.modelgen.config.config.AlwaysCreateStrategy} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AlwaysCreateStrategyItemProvider alwaysCreateStrategyItemProvider;

	/**
	 * This creates an adapter for a {@link uk.ac.york.cs.mv525.modelgen.config.config.AlwaysCreateStrategy}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createAlwaysCreateStrategyAdapter() {
		if (alwaysCreateStrategyItemProvider == null) {
			alwaysCreateStrategyItemProvider = new AlwaysCreateStrategyItemProvider(this);
		}

		return alwaysCreateStrategyItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link uk.ac.york.cs.mv525.modelgen.config.config.AlwaysRetrieveStrategy} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AlwaysRetrieveStrategyItemProvider alwaysRetrieveStrategyItemProvider;

	/**
	 * This creates an adapter for a {@link uk.ac.york.cs.mv525.modelgen.config.config.AlwaysRetrieveStrategy}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createAlwaysRetrieveStrategyAdapter() {
		if (alwaysRetrieveStrategyItemProvider == null) {
			alwaysRetrieveStrategyItemProvider = new AlwaysRetrieveStrategyItemProvider(this);
		}

		return alwaysRetrieveStrategyItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link uk.ac.york.cs.mv525.modelgen.config.config.AlwaysRetrieveOrCreateStrategy} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AlwaysRetrieveOrCreateStrategyItemProvider alwaysRetrieveOrCreateStrategyItemProvider;

	/**
	 * This creates an adapter for a {@link uk.ac.york.cs.mv525.modelgen.config.config.AlwaysRetrieveOrCreateStrategy}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createAlwaysRetrieveOrCreateStrategyAdapter() {
		if (alwaysRetrieveOrCreateStrategyItemProvider == null) {
			alwaysRetrieveOrCreateStrategyItemProvider = new AlwaysRetrieveOrCreateStrategyItemProvider(this);
		}

		return alwaysRetrieveOrCreateStrategyItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link uk.ac.york.cs.mv525.modelgen.config.config.EolProducer} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EolProducerItemProvider eolProducerItemProvider;

	/**
	 * This creates an adapter for a {@link uk.ac.york.cs.mv525.modelgen.config.config.EolProducer}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createEolProducerAdapter() {
		if (eolProducerItemProvider == null) {
			eolProducerItemProvider = new EolProducerItemProvider(this);
		}

		return eolProducerItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link uk.ac.york.cs.mv525.modelgen.config.config.CombinedProducer} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected CombinedProducerItemProvider combinedProducerItemProvider;

	/**
	 * This creates an adapter for a {@link uk.ac.york.cs.mv525.modelgen.config.config.CombinedProducer}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createCombinedProducerAdapter() {
		if (combinedProducerItemProvider == null) {
			combinedProducerItemProvider = new CombinedProducerItemProvider(this);
		}

		return combinedProducerItemProvider;
	}

	/**
	 * This returns the root adapter factory that contains this factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ComposeableAdapterFactory getRootAdapterFactory() {
		return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
	}

	/**
	 * This sets the composed adapter factory that contains this factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
		this.parentAdapterFactory = parentAdapterFactory;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean isFactoryForType(Object type) {
		return supportedTypes.contains(type) || super.isFactoryForType(type);
	}

	/**
	 * This implementation substitutes the factory itself as the key for the adapter.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter adapt(Notifier notifier, Object type) {
		return super.adapt(notifier, this);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object adapt(Object object, Object type) {
		if (isFactoryForType(type)) {
			Object adapter = super.adapt(object, type);
			if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
				return adapter;
			}
		}

		return null;
	}

	/**
	 * This adds a listener.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void addListener(INotifyChangedListener notifyChangedListener) {
		changeNotifier.addListener(notifyChangedListener);
	}

	/**
	 * This removes a listener.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void removeListener(INotifyChangedListener notifyChangedListener) {
		changeNotifier.removeListener(notifyChangedListener);
	}

	/**
	 * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void fireNotifyChanged(Notification notification) {
		changeNotifier.fireNotifyChanged(notification);

		if (parentAdapterFactory != null) {
			parentAdapterFactory.fireNotifyChanged(notification);
		}
	}

	/**
	 * This disposes all of the item providers created by this factory. 
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void dispose() {
		if (modelElementOverrideItemProvider != null) modelElementOverrideItemProvider.dispose();
		if (modelConfigurationItemProvider != null) modelConfigurationItemProvider.dispose();
		if (modelElementExclusionItemProvider != null) modelElementExclusionItemProvider.dispose();
		if (fileStringPoolItemProvider != null) fileStringPoolItemProvider.dispose();
		if (embeddedStringPoolItemProvider != null) embeddedStringPoolItemProvider.dispose();
		if (stringPoolEntryItemProvider != null) stringPoolEntryItemProvider.dispose();
		if (referenceOverrideItemProvider != null) referenceOverrideItemProvider.dispose();
		if (randomProducerItemProvider != null) randomProducerItemProvider.dispose();
		if (alwaysCreateStrategyItemProvider != null) alwaysCreateStrategyItemProvider.dispose();
		if (alwaysRetrieveStrategyItemProvider != null) alwaysRetrieveStrategyItemProvider.dispose();
		if (alwaysRetrieveOrCreateStrategyItemProvider != null) alwaysRetrieveOrCreateStrategyItemProvider.dispose();
		if (eolProducerItemProvider != null) eolProducerItemProvider.dispose();
		if (combinedProducerItemProvider != null) combinedProducerItemProvider.dispose();
	}

}
